import React, { memo } from 'react';

function MyComponent(props) {
  console.log('MyComponent render');
  return <div>{props.text}</div>;
}

export default memo(MyComponent, (prevProps, nextProps) => {
  // 对比 props 的 text 属性，如果相同，则不重新渲染组件
  return prevProps.text === nextProps.text;
});
